﻿@{
    ViewBag.Title = "检验申请单";
    Layout = "~/Views/Shared/_Form.cshtml";
}

<form id="formPatSer" style="margin:2px;margin-top:10px;">
    <div class="gridPanel">
        <div>
            <table class="form">
                <tr>
                    <th class="formTitle">申请单时间范围：</th>
                    <td class="formValue" colspan="2">
                        <input id="kssj" type="text" class="form-control input-wdatepicker" style="width:30%;  float:left;" value="@DateTime.Now.ToString("yyyy-MM-dd")" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" />
                        <span style="margin-left:1%;float:left">—</span>
                        <input id="jssj" type="text" class="form-control input-wdatepicker" style="width:30%; float:left;margin-left:1%;" value="@DateTime.Now.ToString("yyyy-MM-dd")" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" />
                    </td>
                    <th class="formTitle">组套名称：</th>
                    <td class="formValue">
                        <input id="ztmc" type="text" class="form-control" placeholder="组套名称" />
                    </td>
                    <td class="formValue">
                        &nbsp;&nbsp;
                        <input type="button" id="btn_search" class="btn btn-primary" value=" 查 询 " />
                        <a href="~/File/LisApp.rar">LisApp</a>
                    </td>
                </tr>
            </table>
        </div>
        <table id="gridList" rel="formPatSer"></table>
        <div id="gridPager" style="padding-right:20%"></div>
    </div>
</form>
<script lang="javascript">
    var mzzyh = $.request("mzzyh");
    var type = $.request("type");
    $(function () {
        gridList();
    })

    $('#btn_search').click(function () {
        //$("#gridList").clearGridData();
        var kssj = $('#kssj').val();
        var jssj = $('#jssj').val() + " 23:59:59";
        var ztmc = $('#ztmc').val();
        $("#gridList").jqGrid('setGridParam', {
            postData: { mzzyh: mzzyh, type: type, ztmc: ztmc, kssj: kssj, jssj: jssj },
        }).trigger('reloadGrid'); //重新加载当前表格
    });

    function gridList() {
        var kssj = $('#kssj').val();
        var jssj = $('#jssj').val() + " 23:59:59";
        var ztmc = $('#ztmc').val();
        var $gridList = $("#gridList");
        $gridList.dataGrid({
            url: "/MedicalRecord/GetLisSqdhGridJson",
            autowidth: false,
            postData: { mzzyh: mzzyh, type: type, ztmc: ztmc, kssj: kssj, jssj: jssj },
            width: $("#formPatSer").width()-10,
            height: $(window).height() - 120,
            colModel: [
                { label: '姓名', name: 'xm', align: 'left', hidden: true},
                //{ label: '性别', name: 'xb', align: 'left', hidden: true },
                { label: '申请单号', name: 'lissqdh', align: 'left', width:'200px' },
                { label: '组套名称', name: 'ztmc', align: 'left', width: '240px' },
                { label: '申请时间', name: 'sqsj', align: 'left', width: '150px' },
                { label: '申请单状态', name: 'syncStatus', align: 'left',width: '80px' },
               //{ label: 'ztId', name: 'ztId', hidden: true },
               //{ label: '总金额', name: 'zje' ,align: 'left'}
                {
                    label: "操作", name: "", align: "center", width: 100,
                    formatter: function (cellvalue, options, rowobject) {
                        return "<a href=\#\" onclick='recall1(\"" + rowobject.lissqdh + "\",\"" + rowobject.syncStatus + "\")'' title='lis报告' style='text-decoration: none;color: #dd4b39;cursor: pointer;'>查看报告</a>";
                    }
                }
            ],
            pager: "#gridPager",
            sortname: 'sqsj desc',
            viewrecords: true
        });
    }

    function recall1(lissqdh, syncStatus) {
        if (syncStatus != "已完成") {
            $.modalAlert("当前状态不是已完成状态不能查看报告", 'warning');
            return;
        } else {
            $.ajax({
                url: "http://127.0.0.1:22228/api/CQSmartCheck/GetLisReport",//lis报告
                dataType: "json",
                data: { type: type, brxx_id: lissqdh },
                type: "POST",
                async: true,
                success: function (ajaxdata) { }
            });
        }
    }

    function btn_edit() {
        var $gridList = $("#gridList");
        if ($gridList.jqGridRowValue().syncStatus != "已完成") {
            $.modalAlert("当前状态不是已完成状态不能查看报告", 'warning');
            return;
        } else {
            $.ajax({
                url: "http://127.0.0.1:22228/api/CQSmartCheck/GetLisReport",//lis报告
                dataType: "json",
                data: { type: type, brxx_id: $gridList.jqGridRowValue().lissqdh },
                type: "POST",
                async: true,
                success: function (ajaxdata) { }
            });
        }
    }
</script>
